using GameLogic.GameLogic;
using System.Collections;
using System.Collections.Generic;
using TEngine;
using UnityEngine;

namespace GameLogic
{
    [Window(UILayer.UI)]
    public class MainUI : UIWindow
    {
        public DragPanel dragPanel;
        public PlayerBagInventoryWindow playerBagInventoryWindow;
        public ItemTooltip ItemTooltipPanel;
        public CursorManager cursorManager;
        public TimeUI TimeUI;

        protected override void ScriptGenerator()
        {
            dragPanel = FindChild("FarmMainUI/DragPanel").gameObject.GetComponent<DragPanel>();
            playerBagInventoryWindow = FindChild("FarmMainUI/PlayerBagInventoryWindow").gameObject.GetComponent<PlayerBagInventoryWindow>();
            ItemTooltipPanel = FindChild("FarmMainUI/ItemToolTipPanel/ItemToolTip").gameObject.GetComponent<ItemTooltip>();
            cursorManager = FindChildComponent<CursorManager>("CursorPanel");
            TimeUI = FindChild("FarmMainUI/GameTime").gameObject.GetComponent<TimeUI>();
            Init();
        }


        public void Init()
        {
            OnGameStart();
        }

        public void OnGameStart()
        {
            GridMapManager.Instance.Init();
            EnhancedTimeWeatherSystem.Instance.Init();
            ItemManager.Instance.Init();
            CropManager.Instance.Init();
            playerBagInventoryWindow.Init();
            TimeUI.gameObject.SetActive(true);
            GameEvent.Get<ILoginUI>().AfterSceneLoadedEvent();
        }
        
    }
}
